﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LTJ.FrameWork;
using LTJ.Common;
using LTJ.Entity;

namespace uswinweb.admin
{
    public partial class usergroup_update : AdminPage
    {
        public int groupID = SASRequest.GetInt("gid", 0);
        public UserGroupInfo ugInfo = new UserGroupInfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            ugInfo = UserGroup.GetUserGroupInfo(groupID);
            if (ugInfo == null)
            {
                base.ShowAndRedirect(this, "用户组不存在！", "usergroup_index.aspx");
            }
            if (SASRequest.IsPost())
            {
                UpdateUserGroup();
            }
        }
        protected void UpdateUserGroup()
        {
            string ugName = SASRequest.GetFormString("ugNametxt");
            int ugSort = SASRequest.GetFormInt("ugSorttxt", 0);
            int ugStatus = SASRequest.GetFormInt("status", 1);
            ugInfo.name = ugName;
            ugInfo.sort = ugSort;
            ugInfo.status = ugStatus;
            bool msg = UserGroup.UpdateUserGroup(ugInfo);
            if (msg == true)
            {
                base.RegisterStartupScript("PAGE", "parent.document.getElementById('reclick').click();parent.Lightview.hide();");
            }
            else
            {
                base.RegisterStartupScript("PAGETEMPLATE", "更新失败！");
            }
        }
    }
}